package GUI;
import processing.core.PImage;

public class InfoButton extends Component
{
	public boolean state;
	public boolean pressed;
	public String label;
	////////////////////////////////////////////////////////////////////////////////////////////////////
	public InfoButton()
	{
		state = false;
		width =16;
		height =20;
	}
	public void draw()
	{
		Utils.globalProcessing.textFont(Utils.plotFont, 14);

		int cx = x;
		int cy = y;
		
		if(label != null)
		{
			Utils.globalProcessing.textAlign(Utils.globalProcessing.LEFT);
			
			
			
			if(mouseOver()) 
			{
				super.draw();
				if(Utils.globalProcessing.mousePressed)
				{
					Utils.gu.drawBox(x, y, width, height, 0, Utils.globalProcessing.color(150, 150, 200), 255);
					Utils.gu.drawBox(x, y, width, height, 1, Utils.globalProcessing.color(150, 150, 200), 150);
					cx += 1;
					cy += 1;
					pressed = true;

				}
				else if(pressed)
				{
					pressed = false;
					
					if(state){
					state = false;
					}
					else {
					state = true;
					}
			
				}
			}
			else
			{
				pressed = false;
			}

			Utils.globalProcessing.strokeWeight(1);
			Utils.globalProcessing.fill(Utils.textColor);
			Utils.globalProcessing.text(label, cx + 5, cy + 15);
		}
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////
	PImage icon;

}